# llvm 目录
#  /zion0/git_proj/llvm-project-llvmorg-18.1.0/


cat > /zion0/git_proj/l0_nvfs_local_build_llvm.sh << "EOF"
set -eux

build_core=40

build_base='/zion0/git_proj/l0_nvfs_local_build_llvm'

build_llvm=${build_base}/build-llvm
build_clang=${build_base}/build-clang
installprefix=${build_base}/install
llvm=/zion0/git_proj/llvm-project-llvmorg-18.1.0/

rm -rf $build_llvm || echo 0
mkdir -p $build_llvm
mkdir -p $installprefix

time cmake -G Ninja -S $llvm/llvm -B $build_llvm \
      -DLLVM_INSTALL_UTILS=ON \
      -DCMAKE_INSTALL_PREFIX=$installprefix \
      -DCMAKE_BUILD_TYPE=Release  2>&1 | tee ${build_base}/build.log

time ninja -C $build_llvm  -j${build_core} 2>&1 | tee ${build_base}/ninja_build.log

EOF


cat > /zion0/git_proj/docker_build.sh <<"EOF"
docker run --rm \
    -v /zion0/git_proj:/zion0/git_proj \
    openeuler/openeuler:build_llvm_ccache \
    bash /zion0/git_proj/l0_nvfs_local_build_llvm.sh
EOF


lof_file='/zion0/git_proj/l0_nvfs_local_build_llvm.log'

nohup   bash /zion0/git_proj/docker_build.sh 2>&1 > ${lof_file} &

tail -f ${lof_file}
